package com.epam.zhilko.runner;

import com.epam.zhilko.entity.Department;
import com.epam.zhilko.entity.Employee;
import com.epam.zhilko.entity.Project;
import com.epam.zhilko.entity.Vehicle;
import com.epam.zhilko.util.DAO;

import javax.persistence.EntityManager;
import javax.persistence.Persistence;


/**
 * Created with IntelliJ IDEA.
 * User: admin
 * Date: 11/26/13
 * Time: 10:03 AM
 * To change this template use File | Settings | File Templates.
 */
public class Main {
    private static EntityManager em;

    public static void main(String[] args) {
        em = Persistence.createEntityManagerFactory("projectPersistence").createEntityManager();


        /*Department it = new Department();
        it.setName("Management");

        Employee e = new Employee();
        e.setName("John");
        e.setDepartment(it);

        Project proj = new Project();
        proj.setName("Important project");
        proj.getEmployees().add(e);
        e.getProjects().add(proj);

        Vehicle vehicle = new Vehicle();
        vehicle.setMake("Daewoo");
        vehicle.setModel("Matiz");

        e.setVehicle(vehicle);
        it.setHeadOfDepartment(e);



        em.getTransaction().begin();
        em.persist(e);
        em.getTransaction().commit();
        em.close();*/

        DAO dao = new DAO();

        Employee emp = dao.findEmployeeByID(1);
        String name = emp.getName();
        System.out.println(name);

    }

}
